1. Field of the Invention
The present invention relates to a method of forming a mask in an image processing operation and, more particularly, to a method of forming a mask in an image processing operation conducted for the purpose of examining the appearances of articles.
2. Description of the Related Arts
The present invention relates to a method of forming a mask in image processing. In general, a method for checking the appearances of articles for any defect by an image processing technique employs a comparison between image data of a region determined in accordance with the configuration of the article as the examination object and the image data actually obtained from the article, so that any defect can be detected on the basis of the difference between these two kinds of image data. In the case where a multiplicity of articles are examined, as in the case of a production line, it is often experienced that the configurations of the article delicately differ from one another. It has been therefore attempted to approximate, with a known function, the contour of the examination object of the input image data, for each type of article, and a predetermined region is extracted from the approximating function so as to be used as the region conforming with the configuration of the examination object. The known function approximating the configuration of the examination object may be linear lines which are determined by the least square method on the basis of the points of the configuration, or a pattern determined by such linear lines. The function also may be a circle or a quadratic function.
The present applicant has filed an application for a patent, as Japanese Patent Application No. 2-293349, on an improvement in an image processing apparatus which is shown in FIG. 8 attached hereto. Referring to FIG. 8, the image processing apparatus 50 has an image LSI control device 51, the input end of which is connected to a switching control device 52 which is composed of a mode change-over circuit 54 and a synchronizing device 55. The mode switching circuit 54 is adapted to be changed-over by the MPU (main processing unit) 53. More specifically, the mode switching circuit 54 operates in response to a control signal from the MPU 53 so as to connect the latter selectively either to the synchronizing device 55 or the image LSI (large scale integrated circuit) control device 51. Consequently, the LSI control device 51 receives, either from the MPU 53 or the synchronizing device 55, a trigger signal S.sub.T for controlling an image processing LSI 56 which is a module exclusively for image processing. The synchronizing device 55 also receives a synchronizing signal which is supplied from a synchronizing signal generating circuit 57 adapted for generating the synchronizing signal of TV (television) rate. The synchronizing device 55 synchronizes the output of the MPU 53 with the synchronizing signal from the synchronizing signal generating circuit 57 and delivers the same to the image LSI control device 51 as the trigger signal S.sub.T for triggering the operation of the image processing LSI 56. The MPU 53 controls all the devices in the apparatus 50, including an input selection circuit 58 and an output selection circuit 59.
A buffer device 61 is provided between the input selection circuit 58 and an analog-to-digital (A/D) converter 60. The input buffer device 61 includes a pair of image input memories 62a, 62b and a memory change-over portion 63 for selectively connecting one of the image input memories 62a, 62b to the A/D converter 60. The trigger signal S.sub.T from the switching control device 52 is supplied to the input buffer device 61 as the switching timing signal for the switching between the image input memories 62a and 62b.
The image processing LSI 56 has three pins (input 1, input 2, input 3) which are not shown, so that it can simultaneously read the image data stored in any three memories selected by the input selection circuit 58 out of the image memories 64a, 64b, 64c, . . . , 64n and the image input memory 62a, 62b. The memory switching portion 63, however, is so constructed as not to allow the image input memories 62a, 62b to be selected simultaneously.
An image output memory 65, connected to the output selection circuit 59, temporarily holds the data output from the image processing LSI 56 and delivers the same to a display 67 via a digital-to-analog converter (D/A) 66.
According to this arrangement, the switching control device 52 performs, at a predetermined period or at an arbitrarily timing, the switching between a plurality of image input memories 62a, 62b, and the data from the selected image input memory is read, in synchronization with the switching, by the image processing LSI 56 which is a module used exclusively for the image processing. For instance, when it is necessary to process an image determined by image data picked up by a TV camera 68, it is possible to operate the image processing LSI 56 in synchronization with the TV rate. Therefore, when processing image data from an image input device which does not require a synchronizing signal, as is the case of processing of image data from the image memories 64a, 64b, 64c, . . . , 64n, it is possible to execute the processing by the image processing LSI 56 in such a manner as to cope with variation in the processing time, thus attaining a remarkable improvement in the image data processing efficiency.
When the image processing LSI 56 is connected to readable image memories 64a, 64b, 64c, . . . , 64n for processing data in such memories, the switching control device 52 delivers a processing start trigger signal S.sub.T to the image processing LSI 56 at a timing corresponding to the length of the processing time, so that the image processing LSI 56 is controlled in accordance with the length of the processing time. For instance, when the image processing performed by the image processing LSI 56 and the processing performed by the MPU 53 which controls the whole apparatus 50 are to be executed consecutively, the image processing LSI 56 can be controlled in accordance with the length of the processing time, so that the data processing efficiency is improved.
This improved apparatus, however, is still unsatisfactory in that it suffers from the following problem which is encountered when the articles to be examined have prints of letters or symbols as in the cases of electronic parts or when the articles are plastic parts having complicated configurations such as gears. More specifically, the examination of the surface state or configuration of an article with letters or symbols printed thereon is conducted by inputting multi-value image data showing the surface state or configuration of the article and finding any difference in the gradation values of pixels corresponding to the non-defective portion and the gradation values of pixels corresponding to the defective portion. In some cases, however, there is only a slight difference in the gradation value between any defective part and the printed letters or symbols, making it difficult to decisively discriminate between such defective part and the printed letters or symbols. Such a problem would be overcome by forming a masking region which would conceal the printed letters or symbols so as to neglect the data carried by the pixel inside such a mask. It is, however, extremely difficult to approximate contours of characters such as Japanese hiragana and kanjis with linear lines, circle or quadratic function through the least square method.
Examination of surface state or contour of a plastic article having a complicated configuration such as a gear also is conducted by inputting multi-value image data showing the surface state or configuration of the article and finding any difference in the gradation values of pixels corresponding to the non-defective portion and the gradation values of pixels corresponding to the defective portion. In this case, difficulty is encountered in the discrimination between defective and non-defective portions, particularly when only a small difference is presented in the gradation value between the pixels corresponding to the defective portion and pixels corresponding to background or letter portion.
As will be understood from the foregoing description, the aforementioned method relying upon formation of a region on the image data by approximating the configuration of the examination object through approximation by a function cannot satisfactorily be used in the examination of appearances of articles which are complicated in configurations or which have letters or symbols printed thereon.